import java.util.Random;
import java.util.Scanner;

/**
 * @author fjx
 */
public class GuessNumber {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        Random random = new Random();
        while (true) {
            for (int i = 0; i < 7; i++) {
                int guess = random.nextInt(100) + 1;
                System.out.println("输入你猜的数字");
                int number = scanner.nextInt();
                if (guess > number) {
                    System.out.println("你猜小了");
                } else if (guess < number) {
                    System.out.println("你猜大了");
                } else {
                    System.out.println("恭喜你，猜对了");
                    break;
                }
            }
            System.out.println("继续游玩请输入y,否则请输入其他字符");
            String str= scanner.next();
            if (!"y".equals(str)){
                break;
            }
        }
    }
}
